  <link rel="stylesheet" type="text/css" media="all" href="__PUBLIC__/Admin/assets/skin/modelstyle.css">
  <script type="text/javascript" src="__PUBLIC__/Admin/js/jquery.leanModal.min.js"></script>
<div id="content" class="">
        <div class="row">
          <div class="col-md-12">
            <!-- Input Fields -->
            <div class="panel">
              <div class="panel-heading">
                <span class="panel-title">模型信息列表</span>
              </div>
              <div class="panel-body">
              <div class="panel">
              <!-- message toolbar header -->
              <div class="panel-menu" style='border-left:1px solid #e2e2e2; border-right:1px solid #e2e2e2;'>
                <div class="row">
                  <div class="hidden-xs hidden-sm col-md-3">
                    <div class="btn-group">
                      <a href="#loginmodal" class="btn btn-default light" onclick="setgourl('backsql');" title="新增信息" id="backsql" data-url="{:U('Model/action',array('act'=>'bac'))}">
                        <i class="fa fa-file-o"></i> 新增备份</a>
                    </div>
                  </div>

                
                </div>
              </div>

              <div id="act_bac" style="display: none" data-url="{:U('Model/action',array('act'=>'bac'))}" ></div>
              <div id="act_del" style="display: none" data-url="{:U('Model/action',array('act'=>'del'))}" ></div>
              <div id="act_rel" style="display: none" data-url="{:U('Model/action',array('act'=>'rel'))}" ></div>
              <div id="act_dow" style="display: none" data-url="{:U('Model/action',array('act'=>'dow'))}" ></div>

              <!-- message listings table -->
              <div class="panel-body pn">
                <table id="message-table" class="table admin-form theme-warning tc-checkbox-1">
                  <thead>
                    <tr class="">
                      <th class="text-center  hidden-xs" width="5%">ID</th>
                      <th class="text-center  hidden-xs" width="30%">文件名</th>
                      <th class="text-center  hidden-xs" width="15%">备份时间</th>
                      <th class="text-center  hidden-xs" width="15%">文件大小</th>
                      <th class="text-center  hidden-xs" width="15%">操作</th>
                    </tr>
                  </thead>
                  <tbody>

                    <?php
                     if($list){
                      foreach($list as $k => $v){   ?>
                        <tr class="message-unread">
                        
                          <td class="text-center">{$v['id']}</td>
                          <td class="text-center">{$v['title']}</td>
                          <td class="text-center">{$v['time']}</td>
                          <td class="text-center ">{$v['size']}KB</td>
                          <td class="text-center">
                            <div class="btn-group">
                            <a href="#loginmodal" id="dow_{$v['id']}" onclick="setgourl('dow_{$v['id']}');" data-url="{:U('Model/action',array('act'=>'dow','file'=>$v['title']))}" title ="下载" class="btn btn-xs btn-success"><i class="fa">下载</i></a>
                            <a href="#loginmodal" id="rel_{$v['id']}" onclick="setgourl('rel_{$v['id']}');" data-url="{:U('Model/action',array('act'=>'rel','file'=>$v['title']))}"  title ="还原" class="btn btn-xs btn-warning "><i class="fa">还原</i></a>
                            <a href="#loginmodal" id="del_{$v['id']}" onclick="setgourl('del_{$v['id']}');" data-url="{:U('Model/action',array('act'=>'del','file'=>$v['title']))}"  class="btn btn-xs btn-danger " title ="删除"><i class="fa" >删除</i></a>
                            </div>
                          </td>
                        </tr>
                    <?php  }}?>
                  </tbody>
                </table>
              </div>

            <div >
             <div class="pagination pull-left"></div>
              <ul class="pagination pull-right">
                {$page}
              </ul>
            </div>
            </div>
              </div>
            </div>
          </div>
        </div>
</div>

  

    
 
  <div id="loginmodal" style="display:none;">
    <h1>请输入密码</h1>
      <label for="password">请确认进行数据库操作，在下方输入管理密码！</label>
      <div style="height: 20px;"></div>
      <input type="password" name="password" id="password" class="txtfield" tabindex="2">
      <div class="center">
        <input type="submit" name="loginbtn" id="loginbtn" class="flatbtn-blu hidemodal" value="确认" onclick="doaction()" tabindex="3">
      </div>
  </div>
<script type="text/javascript">
var act   = '';
var gourl = '{:U('Model/back')}';
$(function(){
  $('#loginform').submit(function(e){
    return false;
  });
  $('#backsql').leanModal({ top: 110, overlay: 0.45, closeButton: ".hidemodal" });
  <php>foreach($list as $k => $v){</php>
    $('#dow_{$v['id']}').leanModal({ top: 110, overlay: 0.45, closeButton: ".hidemodal" });
    $('#rel_{$v['id']}').leanModal({ top: 110, overlay: 0.45, closeButton: ".hidemodal" });
    $('#del_{$v['id']}').leanModal({ top: 110, overlay: 0.45, closeButton: ".hidemodal" });
  <php>}</php>

});
function setgourl(dom){
  var ys = $("#"+dom);
  gourl  = ys.attr('data-url');
}

function doaction(){
  var password = $("#password").val();
  var ajaxurl  = '{:U('Ajax/password')}';
  $.post(ajaxurl,{password:password},function(obj){
    if(obj > 0){
        window.location.href = gourl;
    }else{
      alert('密码错误！');
    }
  },'json');

}
</script>
